#!/usr/bin/php

<?php
$source_font = "Fontin-Regular.otf";

$fp = fopen($source_font, "rb");
$o = fopen("font.c", "w");

$i = 0;
fwrite($o, "// $source_font\nconst unsigned char font_data[] = {\n");
while (false !== ($char = fgetc($fp)))
{
  if ($i != 0) fwrite($o, ",");
  $i ++;
  if ($i%10 == 0) fwrite($o, "\n");
  fwrite($o, ord($char));
}
fwrite($o, "};\n");

fclose($o);
fclose($fp);

?>
